package com.ld.wms.business.chat.service.impl;

import com.ld.wms.business.chat.mapper.DataStatisticMapper;
import com.ld.wms.business.chat.model.DataStatisticModel;
import com.ld.wms.business.chat.service.ChatService;
import com.ld.wms.business.chat.service.MaterialReceiveRankingService;
import com.ld.wms.business.chat.vo.resp.DataStatisticRespVo;
import com.ld.wms.business.chat.vo.resp.IndexQuantityDataRespVo;
import com.ld.wms.business.chat.vo.resp.MaterialReceiveRankingRespVo;
import com.ld.wms.common.vo.GenerateListVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class ChatServiceImpl implements ChatService {

    @Autowired
    private DataStatisticMapper dataStatisticMapper;

    @Autowired
    private MaterialReceiveRankingService materialReceiveRankingService;

    @Override
    public IndexQuantityDataRespVo getIndexQuantityData() {
        IndexQuantityDataRespVo respVo = new IndexQuantityDataRespVo();
        respVo.setTemperature(37);
        respVo.setHumidity(new BigDecimal("0.60"));
        respVo.setExpireQuantity(1985);
        respVo.setInventoryInsufficientQuantity(20);
        respVo.setTodayInInventoryQuantity(1001);
        respVo.setTodayOutInventoryQuantity(1);
        respVo.setTodoQuantity(99);
        return respVo;
    }

    @Override
    public DataStatisticRespVo getInfoBoard() {
        GenerateListVo<MaterialReceiveRankingRespVo> materialReceiveListTop10 = materialReceiveRankingService.getMaterialReceiveListTop10();

        DataStatisticRespVo dataStatisticRespVo = new DataStatisticRespVo();
        DataStatisticModel dataStatisticModel = dataStatisticMapper.selectById(1L);
        BeanUtils.copyProperties(dataStatisticModel, dataStatisticRespVo);
        // 试剂领用排行榜
        dataStatisticRespVo.setMaterialReceiveListTop10(materialReceiveListTop10);
        return dataStatisticRespVo;
    }


}
